namespace Daemon.Model.Entities
{
    using Daemon.Data.Substructure.Enums;
    using Microsoft.EntityFrameworkCore;
    using System;
    using System.Collections.Generic;
    public abstract class BaseStaticFilter<T>
        where T : DbContext, new()
    {
        protected BaseStaticFilter(string name, FieldAttribute attributes = FieldAttribute.None)
        {
            Name = name;
            Attributes = attributes;
        }

        public string Name { get; set; }

        public FieldAttribute Attributes { get; set; }
    }

    public class SqlStaticFilter<TContext> : BaseStaticFilter<TContext>
        where TContext : DbContext, new()
    {
        public SqlStaticFilter(string name, string sql, FieldAttribute attributes = FieldAttribute.None)
            : base(name, attributes)
        {
            Sql = sql;
        }

        public string Sql { get; set; }
    }

    public class FuncStaticFilter<TContext> : BaseStaticFilter<TContext>
        where TContext : DbContext, new()
    {
        public FuncStaticFilter(string name, Func<TContext, List<int>> filterFunc, FieldAttribute attributes = FieldAttribute.None)
            : base(name, attributes)
        {
            FilterFunc = filterFunc;
        }

        public Func<TContext, List<int>> FilterFunc { get; set; }
    }
}